import i18n from "@/lang";
import { orsRequest } from "@/utils/request";

// import { createService } from "@/utils/request";
// import { AppModule } from '../store/modules/app';
import { encrypt } from '../utils/auth';

// const tunnyApi = (options: any) => createService(AppModule.baseURL)(options);
// const pandaRequest = (options: any) => createService(AppModule.baseURL)(options);

export default class orsApi {
  /**
   * 获取订单实例列表
   */
  public getOrders(params: any) {
    return orsRequest({
      url: "orderRequest/desktops",
      method: "GET",
      params
    });
  }

  /**
   * 修改订单实例状态
   */
  public editOrderState(data: any) {
    return orsRequest({
      url: "orderRequest",
      method: "PUT",
      data
    });
  }

  /**
   * 删除订单实例
   */
  public deleteOrders(data: any) {
    return orsRequest({
      url: "/orderRequest/batch",
      method: "DELETE",
      data
    });
  }

  /**
   * 获取订单实例消息记录
   */
  public getOrderMessage(params: any) {
    return orsRequest({
      url: "/orderRequest/orderMessage",
      method: "GET",
      params
    });
  }

   /**
   * 实例桌面变更
   */
    public changeDesktop(data: any) {
      return orsRequest({
        url: "/orderRequest/changeDesktops",
        method: "POST",
        data
      });
    }

  /**
   * 获取带宽实例列表
   */
  public getBandwidth(params: any) {
    return orsRequest({
      url: "orderRequest/bandwidths",
      method: "GET",
      params
    });
  }

  /**
 * 修改带宽实例状态
 */
  public editBandwidthState(data: any) {
    return orsRequest({
      url: "/orderBandwidth",
      method: "PUT",
      data
    });
  }

  /**
   * 删除带宽实例
   */
  public deleteBandwidth(data: any) {
    return orsRequest({
      url: "orderBandwidth/batch",
      method: "DELETE",
      data
    });
  }

  /**
   * 重试操作
   */
   public doTryOrders(data: any) {
    return orsRequest({
      url: "orderRequest/doRedo",
      method: "POST",
      data
    });
  }
  /**
   * 批量重试操作
   */
   public doTryBatchOrders(data: any) {
    return orsRequest({
      url: "orderRequest/batch/doRedo",
      method: "POST",
      data
    });
  }

  /**
   * 确认失败、
   */
   public confirmFailedOrders(data: any) {
    return orsRequest({
      url: "orderRequest/doConfirmFailed",
      method: "POST",
      data
    });
  }

  /**
   * 批量确认失败、
   */
   public batchconfirmFailedOrders(data: any) {
    return orsRequest({
      url: "orderRequest/batch/doConfirmFailed",
      method: "POST",
      data
    });
  }

}
